<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'memberJoinForm.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script>
	function formCheck(){
		if( memberform.id.value.length == 0 ){
			alert('ID를 입력해 주세요.');
			memberform.id.focus();
			return false;
		}
		if( memberform.checked.value.length == 0 ){
			alert('ID 중복검사를 해주세요.');
			return false;
		}
		if( memberform.password1.value.length == 0 ){
			alert('비밀번호를 입력해 주세요.');
			memberform.password1.focus();
			return false;
		}
		if( memberform.name.value.length == 0 ){
			alert('이름을 입력해 주세요.');
			memberform.name.focus();
			return false;
		}
		if( memberform.password1.value != memberform.password2.value ){
			alert('비밀번호가 일치하지 않습니다.');
			memberform.password2.select();
			memberform.password2.focus();
			return false;
		}
	}
	function idcheck(){
		if( memberform.id.value.length == 0 ){
			alert('ID를 입력해 주세요.');
			memberform.id.focus();
			return false;
		}
		var id = memberform.id.value;
		location.href='memberIdcheck.action?id='+id;
		
	}
	</script>
	<jsp:include page="../index.jsp"></jsp:include>
  </head>
  
  <body>
    <h4>[ 회원가입 ]</h4>
    <form name="memberform" action="<s:url value="/member/memberJoin.action"/>" method="post" onsubmit="return formCheck();">
    <table>
    <tbody>
    <tr>
    	<td align="center" style="width: 100; background-color: efefef;">ID
    	</td>
    	<td><input name="member.id" value="${session.checked}" id="id" style="width: 150"/>
    	<input type="button" value="ID중복확인" onclick="javascript:idcheck();"/>
    	<input type="hidden" value="${session.checked}" id="checked"/>
    	<font color="red">${fieldErrors.idcheckmsg}</font>
    	</td>
    </tr>
    <tr>
    	<td align="center" style="width: 100; background-color: efefef;">비밀번호
    	</td>
    	<td><input type="password" name="member.password" id="password1" style="width: 150"/>
    	</td>
    </tr>
    <tr>
    	<td align="center" style="width: 100; background-color: efefef;">비밀번호<br/>확인
    	</td>
    	<td><input type="password" id="password2" style="width: 150"/>
    	</td>
    </tr>
    <tr>
    	<td align="center" style="width: 100; background-color: efefef;">이름
    	</td>
    	<td><input name="member.name" id="name" style="width: 150"/>
    	</td>
    </tr>
    <tr>
    	<td align="center" style="width: 100; background-color: efefef;">우편번호
    	</td>
    	<td><input name="member.zipcode1" style="width: 50"/>-<input name="member.zipcode2" style="width: 50"/>
    	</td>
    </tr>
    <tr>
    	<td align="center" style="width: 100; background-color: efefef;">주소
    	</td>
    	<td><input name="member.address" style="width: 300"/>
    	</td>
    </tr>
    <tr>
    	<td align="center" style="width: 100; background-color: efefef;">전화번호
    	</td>
    	<td>
    	<s:select name="member.phone1" list="#{'010':'010', '011':'011'}" theme="simple"/>-
    	<input name="member.phone2" style="width: 50"/>-<input name="member.phone3" style="width: 50"/>
    	</td>
    </tr>
    <tr>
    	<td align="center" style="width: 100; background-color: efefef;">E-mail
    	</td>
    	<td><input name="member.email1" style="width: 120"/>@<input name="member.email2" style="width: 120"/>
    	</td>
    </tr>
    <tr>
    	<td align="center" colspan="2">
    	<input type="submit" value="가입" style="width: 70"/>
    	<input type="reset" value="다시쓰기" style="width: 70"/>
    	</td>    	
    </tr>
    </tbody>
    </table>
    </form>
  </body>
</html>
